TECalText
TECalText Force TextEdit to calculate line-starts
#include <TextEdit.h> TextEdit
void TECalText(hTE );
TEHandle hTE ; handle of an edit record
TECalText recalculates the line breaks for all text in an edit record and in
style-aware edit records, recalculates the line-height array. Use this when
you change the size of an edit record's viewing rectangle (e.g., after calling
SizeWindow). You must also use TECalcText if you store a new handle
into the hText field of an edit record.
hTE is a handle obtained via TENew or TEStylNew. It leads to a
variable-length TERec structure and identifies the edit record to be
affected by this change.
Returns: none

Notes: TECalText reads through the text addressed by the hText handle in the
specified edit record. It then manipulates the nLines field and the lineStarts
array, so that lines wrap at positions corresponding to the width of
TERec.viewRect. Finally, if the TERec.lineHeight field is -1, it
recalculates the values for elements in the TEStyleRec.lhTab array.
Thus, you should call this function after you change the width of viewRect,
or any time you need TextEdit to calculate line breaks (e.g., if you read a
file into a Handle and store that handle into TERec.hText).
The global variable TERecal contains the address of a routine called by
TECalText. You may store the address of a custom routine there if you
want to do fancy, unusual, and exotic operations (such as the unlikely need to
process TABs).
TECalText will call your custom word-break routine repeatedly (if you
have installed one via SetWordBreak).
Note that TECalText may unlock a locked TEHandle, move it, resize it and
then lock it again. This is necessary because the lineStarts array of the
TERec may need to grow. For this reason, you should never depend on your
TEHandle not moving across a call to TECalText, even when that handle is
locked.